package _java8新特性._lambda;

import jnr.ffi.annotations.In;
import lombok.val;

import java.util.function.Consumer;
import java.util.function.Function;

public class Demo_04 {

    public static <R> R typeConv(Function<String, R> function) {
        String str = "1234";
        R res = function.apply(str);
        return res;
    }

    public static void main(String[] args) {
        Integer integer = typeConv(new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                return Integer.parseInt(s+"6");
            }
        });
        System.out.println(integer);

        Integer integer1 = typeConv(s -> Integer.parseInt(s+"5"));
        System.out.println(integer1);
    }
}
